package cn.com.connext.scrm.repository.master;


import cn.com.connext.scrm.domain.master.TmpMsgRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface TmpMsgRecordRepository extends JpaRepository<TmpMsgRecord, String>, JpaSpecificationExecutor {

    @Query(value = "SELECT * FROM tmp_msg_record  WHERE  expire_template_id IS NULL ", nativeQuery = true)
    List<TmpMsgRecord> findNoSendExpire();
    @Query(value = "SELECT * FROM tmp_msg_record  WHERE  id = :id", nativeQuery = true)
    TmpMsgRecord findById(@Param("id") Integer id);
    @Query(value = "SELECT * FROM tmp_msg_record  WHERE  is_expire_message = 1 ", nativeQuery = true)
    List<TmpMsgRecord> findNewNoSendExpire();
}
